﻿using System;
using System.Runtime.InteropServices;
using NETWORKLIST;

namespace BSonPosh.Network
{
	public class NLM : IDisposable
	{
		public NLM()
		{
			Manager = new NetworkListManager();
		}

		public INetworkListManager Manager { get; private set; }

		//Implement IDisposable to free up unmanaged resources and unsubscribe event sink.
		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (disposing)
			{
				//UnAdviseforNetworklistManagerEvent();
				//UnAdviseforNetworkEvent();
				Marshal.FinalReleaseComObject(Manager);
			}
		}

		// Use C# destructor syntax for finalization code.
		~NLM()
		{
			Dispose(false);
		}
	}
}